<%@ page language="java"
	import="java.util.*,com.tjsinfo.tjsoa.common.PaginationSupport"
	pageEncoding="UTF-8"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.tjsinfo.tjsoa.meetingroom.vo.MeetingRoomEmploy"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	PaginationSupport paginationSupport = (PaginationSupport) request.getAttribute("againEmpolyList");

	List<MeetingRoomEmploy> infos = paginationSupport.getItems();
	String time=(String)request.getAttribute("time");
	String year=(String)request.getAttribute("year");
	String month=(String)request.getAttribute("month");
	String roomId=(String)request.getAttribute("roomId");
	
	//页面的翻页用变量
	String pageNoStr = request.getParameter("pageNo");
	if (pageNoStr == null)
		pageNoStr = "0";
	Integer pageNo = Integer.valueOf(pageNoStr);
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<html:base />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>粮油集团协同办公平台</title>
		
		<link rel="stylesheet" type="text/css" href="<%=basePath%>ajaxFramework/ext-2.1/resources/css/ext-all.css" />
		<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/adapter/ext/ext-base.js"></script>
	  	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/ext-all.js"></script>
		<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/source/locale/ext-lang-zh_CN.js"></script>
		<style>
#container {
	width: 600px;
	height: 300px;
	border: 3px solid #c3daf9;
}

.calendar {
	background-image: url(<%=basePath%>images/icon_64.gif) !important;
}

.blist {
	background-image: url(<%=basePath%>images/icon_64.gif) !important;
}

.bmenu {
	background-image: url(<%=basePath%>images/ju.gif) !important;
}

.menu-title {
	background: #ebeadb url(<%=basePath%>images/icon_64.gif) repeat-x;
	border-bottom: 1px solid #99bbe8;
	color: #15428b;
	font: bold 10px tahoma, arial, verdana, sans-serif;
	display: block;
	padding: 3px;
}

.lan01 {
	background: url(<%=basePath%>images/lanbg01.gif) no-repeat 0 0;
	width: 6px;
	height: 24px;
}

.lan02 {
	background: url(<%=basePath%>images/lanbg02.gif) repeat-x;
	width: 99%;
	height: 24px;
}

.lan03 {
	background: url(<%=basePath%>images/lanbg03.gif) no-repeat;
	width: 8px;
	height: 24px;
}

.cha {
	padding-top: 3px
}
</style>
		<link href="<%=basePath%>style/txlz7.css" rel="stylesheet"
			type="text/css" />
		<link href="<%=basePath %>ajaxFramework/ext-2.1/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/adapter/ext/ext-base.js"></script>
	    <script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/ext-all.js"></script>
	    <script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/source/locale/ext-lang-zh_CN.js"></script>
		<script type="text/javascript">
 		function submitpages(value){
			if(value==-1){
				Ext.MessageBox.alert('提示框','<nobr>请重新选择页码</nobr>');
				return ;
			}
			window.location.href='<%=basePath%>tjsinfo/tjsoa/meetingroom/arrangements.do?pageNo='+value+'';
		}
		function deletefrom(id)
	    {
	       document.form1.id.value = id;
		   Ext.MessageBox.confirm('提示框', '您确认删除此会议安排？', function(btn){
				if(btn=='yes'){
					deleteWorkSummary();
				}
			});
	    }
		function deleteWorkSummary()
	    {
		   var form1 =  document.getElementById('form1');
		   form1.setAttribute('action','<%=basePath%>tjsinfo/tjsoa/meetingroom/deleteArrangements.do');
		   document.form1.submit();
	    }
	    
	    window.onload = function(){
			var tb = new Ext.Toolbar(
				{
					height:25
				}
			);
		
		    tb.render('menu');
			tb.add(
		    {
		            text:'新增会议',
		            iconCls: 'daohang',
		        	handler: function(){
		        		location.href="<%=basePath%>tjsinfo/tjsoa/meetingroom/arrangementsSpecific.do";
					}
		    },
		    {
		            text:'会议记录',
		            iconCls: 'daohang',
		        	handler: function(){
		        		location.href="<%=basePath%>tjsinfo/tjsoa/meetingroom/pass.do";
					}
		    }
		    );
			tb.addFill();
		    tb.addText('<img id="windowResize" src="<%=basePath%>images/m_icon05.gif;"><a style="font-weight:bold; color:black;line-height: 22px;">会议安排</a>&nbsp;&nbsp;&nbsp;');
		}
	    </script>
	</head>
	<body>
	<div id="right">
		<div id="menu" style="padding-top:4px;"></div>
		<div style="height: 91%;">
				<table width="100%" border="0" cellspacing="0" cellpadding="0"
					height="100%">
					<tr>
						<td width="100%" valign="top" height="100%">
							<div class="contabwd">
								<table class="p_06" width="100%" border="0" cellspacing="0">
									<tr>
										<th width="11%" style="text-align: center">
											申请日期
										</th>
										<th width="11%" style="text-align: center">
											会议名称
										</th>
										<th width="12%" style="text-align: center">
											计划开始时间

										</th>
										<th width="12%" style="text-align: center">
											计划结束时间
										</th>
										<th width="11%" style="text-align: center">
											会议室名称

										</th>
										<th width="20%" style="text-align: center">
											地点
										</th>
										<th width="20%" style="text-align: center">
											操作
										</th>
									</tr>
									<%
										int a = 1;
										SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
										for (Iterator iterator = infos.iterator(); iterator.hasNext();) {
											MeetingRoomEmploy mre = (MeetingRoomEmploy) iterator.next();
											String name = mre.getMeetingName();
											if(mre.getMeetingName().length()>7)mre.setMeetingName(name.substring(0,7));
											String roomName = mre.getMeetingRoomMain().getMeetingroomName();
											if(mre.getMeetingRoomMain().getMeetingroomName().length()>7)mre.getMeetingRoomMain().setMeetingroomName(roomName.substring(0,7));
											String place = mre.getMeetingRoomMain().getPlace();
											if(mre.getMeetingRoomMain().getPlace().length()>13)mre.getMeetingRoomMain().setPlace(place.substring(0,13));
											if (a % 2 == 0) {
									%>
									<tr bgcolor="#F4F4F4">
										<td><%=mre.getEmpolyTime() %></td>
										<td><a title="<%=name %>" href="<%=basePath%>tjsinfo/tjsoa/meetingroom/openArrangements.do?&id=<%=mre.getId() %>"><%=mre.getMeetingName() %></a></td>
										<td><%=sdf.format(mre.getStartTime()) %></td>
										<td><%=mre.getEndTime() %></td>
										<td><a title="<%=roomName %>"><%=mre.getMeetingRoomMain().getMeetingroomName() %></a></td>
										<td><a title="<%=place %>"><%=mre.getMeetingRoomMain().getPlace() %></a></td>
									    <td>
										<a href="<%=basePath%>tjsinfo/tjsoa/meetingroom/updateArrangements.do?&id=<%=mre.getId() %>">修改</a>|
										<a href="javascript:deletefrom('<%=mre.getId()%>')">删除</a>
										</td>
									</tr>
									<%
										} else {
									%>
									<tr>
										<td><%=mre.getEmpolyTime() %></td>
										<td><a title="<%=name %>" href="<%=basePath%>tjsinfo/tjsoa/meetingroom/openArrangements.do?&id=<%=mre.getId() %>"><%=mre.getMeetingName() %></a></td>
										<td><%=sdf.format(mre.getStartTime()) %></td>
										<td><%=mre.getEndTime() %></td>
										<td><a title="<%=roomName %>"><%=mre.getMeetingRoomMain().getMeetingroomName() %></a></td>
										<td><a title="<%=place %>"><%=mre.getMeetingRoomMain().getPlace() %></a></td>
										<td>
										<a href="<%=basePath%>tjsinfo/tjsoa/meetingroom/updateArrangements.do?&id=<%=mre.getId() %>">修改</a>|
										<a href="javascript:deletefrom('<%=mre.getId()%>')">删除</a>
										</td>
									</tr>
									<%
										}
											a++;
										}
									%>

									<tr align="center">
										<td colspan="7" style="border-bottom: 1px #d0d0d0 solid">
											<div class="page01">
												共<%=paginationSupport.getTotalCount()%>条,共<%=paginationSupport.getPageCount()%>页&nbsp;&nbsp;
												当前为第<%=pageNo + 1%>页&nbsp;&nbsp;

												<%
													if (paginationSupport.getStartIndex() > 1) {
												%>
												<a
													href="<%=basePath%>tjsinfo/tjsoa/meetingroom/arrangements.do?pageNo=<%=pageNo - 1%>">上一页</a>
												<%
													}
												%>

												<%
													if (paginationSupport.getStartIndex()
															+ paginationSupport.getPageSize() < paginationSupport
															.getTotalCount()) {
												%>
												<a
													href="<%=basePath%>tjsinfo/tjsoa/meetingroom/arrangements.do?pageNo=<%=pageNo + 1%>">下一页</a>
												<%
													}
												%>

												&nbsp;&nbsp; 跳转到

												<select name="selectPage" id="selectPage"
													onchange="submitpages(this.value)">
													<option value="0">
														--跳转--
													</option>
													<%
														for (int pi = 0; pi < paginationSupport.getPageCount(); pi++) {
													%>
													<option value="<%=pi%>"><%=pi + 1%></option>
													<%
														}
													%>
												</select>
												页

											</div>
										</td>
									</tr>
								</table>
							</div>
						</td>
					</tr>
				</table>
			</div>
		</div>
		<form name="form1" method="post" id="form1">
			<input type="hidden" name="id" value="" />
		</form>
	</body>
</html>